package com.example.dto;

import lombok.Data;

/**
 * 登录响应DTO
 */
@Data
public class LoginResponse {
    
    /**
     * JWT Token
     */
    private String token;
    
    /**
     * 用户信息
     */
    private UserInfo user;
    
    /**
     * Token 过期时间（时间戳）
     */
    private Long expireTime;
    
    /**
     * 构造函数
     * 与类同名，没有返回值（连 void 都没有），一般都是public
     * @param token
     * @param user
     * @param expireTime
     */
    public LoginResponse(String token, UserInfo user, Long expireTime) {
        this.token = token;
        this.user = user;
        this.expireTime = expireTime;
    }
    
    /**
     * 用户信息内部类
     */
    @Data
    public static class UserInfo {
        private Long id;
        private String username;
        private String email;
        private String role;
        
        public UserInfo(Long id, String username, String email, String role) {
            this.id = id;
            this.username = username;
            this.email = email;
            this.role = role;
        }
    }
}
